package com.qf.flying;

import java.util.Random;
/**
 * K-潘首丞
 * */
public class K
        extends FlyObject
        implements Enemy
{
    private int Xspeed = 1;// 速度
    private int Yspeed = 2;//速度
    private int type;

    public K()
    {
        super();
        award = new Award();

        Random random = new Random(System.currentTimeMillis());
        award.bulletNumbers = random.nextInt(3);
        award.shootSpeed = random.nextInt(21);
        award.bulletSpeed = random.nextInt(5);
        award.bulletType = 1;
        isAward = true;
        life = 300;
        totalLife = 300;
        image = ShootGame.k;
        width = image.getWidth();
        height = image.getHeight();
        y = -height;
        x = (int) (Math.random() * (ShootGame.background.getWidth() - width));
        //定义这个蜜蜂的奖励类型
        Random rad = new Random();
        type = rad.nextInt(2);

    }

    @Override
    public void step()
    {
        y += Yspeed;
        x += Xspeed;
        if (x < 0)
        {
            Xspeed = 1;
        }

        if (x > ShootGame.background.getWidth() - width)
        {
            Xspeed = -1;
        }


    }

    @Override
    public boolean isShot(Bullet b)
    {
        return x < b.x && b.x < x + width && y < b.y && b.y < y + height;
    }

    @Override
    public int getScore()
    {
        return 10;
    }
}
